<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- <meta name="viewport" content="width=device-width, initial-scale=0.5,maxinum-scale=0.5, mininum-scale=0.5,user-scalable=no"> -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maxinum-scale=1.0, mininum-scale=1.0,user-scalable=no">
 

    <!-- <meta name="viewport" content="initial-scale=0.3"> -->
    <title>Document</title>
    <link rel="stylesheet" href="css/normalize.css">
    <script src="libs/rem.js"></script>
    <script src="libs/border1px.js" ></script>

   <style>
       div {
           width:100%;
           height:5000px;
           background: rgba(0,0,0,.27);
           position:fixed;
           top:0;
           left:0;
           display: none;
       }
   </style>
</head>
<body>
<div class="mask" style="display:none">
    请用坚屏
</div>
<script>
// window.onresize = function () {
//     console.log(1);
// }

function hengping () {
    if (window.innerWidth > window.innerHeight) {
        console.log(2);
        document.querySelector('.mask').style.display = 'block';
    } else {
        console.log(3);
        document.querySelector('.mask').style.display = 'none';
    }
}
// window.addEventListener('load', function () {
    hengping();
// })
window.addEventListener('resize', function () {
    hengping();
}) 
</script>
</body>
</html>